using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for CustomCMSBasePage
/// </summary>
public class CustomCMSBasePage : System.Web.UI.Page
{
    /// <summary>
    /// Response Statuses
    /// </summary>
    protected enum ResponseStatus
    {
        Success,
        Fail
    }

    /// <summary>
    /// make sure parameter was passed to the page request.
    /// </summary>
    /// <param name="paramName">parameter to retrieve</param>
    /// <returns>the value of the paramter if passed, exception otherwise</returns>
    protected string GetMandatoryRequestParameter(string paramName)
    {
        string var = Request[paramName];

        if (string.IsNullOrEmpty(var))
            throw new Exception("Parameter " + paramName + " is missing");

        return var;
    }

    protected string CreateResponse(string content, ResponseStatus status)
    {
		return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result status=\"" + status.ToString() + "\">" + content + "</result>";
    }
}
